package cryption

import (
	"crypto/md5"
	"crypto/sha256"
	"encoding/hex"
	"strings"
)

//SHA256 sha加密
func SHA256(data *string) *string {
	hash := sha256.New()
	hash.Write([]byte(*data))
	// io.WriteString(hash, data)
	md := hash.Sum(nil)
	mdStr := hex.EncodeToString(md)
	return &mdStr
}

//生成32位大写的md5字串
func GetMd5String(s string) string {
	h := md5.New()
	h.Write([]byte(s))
	md5Str := hex.EncodeToString(h.Sum(nil))
	return strings.ToUpper(md5Str)
}
